<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>判断闰年</title>
</head>
<body>
    <input type="text" id="yearInp" value="">
    <button id="btnB">判断</button>
    <input type="text" id="resultInp" value="">
</body>
<script>
var year=document.getElementById("yearInp");
var btn=document.getElementById("btnB");
var result=document.getElementById("resultInp");
console.log(year,btn,result);
btn.onclick=function (){
    var yearValue=year.value;
    var a;
    if(yearValue>=1000&&yearValue<=4000){
        if( (yearValue%400)==0  ){
            a="世纪闰年"
        }
        else if(yearValue%4==0&&yearValue%100!=0){
            a="普通闰年"
        }
        else{
            a="不是闰年"
        }
    }
    else{
           a="请输入正确的年份";
        }
    resultInp.value=a;
}
</script>
</html>